/*
 * 2017.06.26 华磊
 * 添加判断 : 如果IP有所记录 就不umount
 */

#ifndef MOUNTDELEGATE_H
#define MOUNTDELEGATE_H

#include <QDebug>
#include <QThread>
#include <QTimer>
#include <QStringList>

#include "../CommunicateDelegate/hmicommunicate.h"
class CommunicateNormalDelegate;

class MountDelegate : public QObject
{

    Q_OBJECT
public:
    MountDelegate(CommunicateNormalDelegate *communicateNormalIn, GlobalData *globalDataIn);
    ~MountDelegate();


public slots:
    /**
     * @brief mountFileAddress
     * @param list:  ip+port
     * @param mountPath :
     */
    void mountFileAddress(QStringList list, QString mountPath);

    void timeoutSlot();
    void slot_hmi_ip_port(QString ip,int port){
        hmiIp=ip;
        hmiPort=port;
    }

signals:
    void readDefaultFileNameSignal();//废弃

    /**
     * @brief msgBoxSignal                  通知 打开消息框
     */
    void msgBoxSignal(int type,QString title,QString text);

private:
    void mountFileAddress_linux(QStringList list, QString mountPath);
    void mountFileAddress_windows(QStringList list, QString mountPath);


private:
    CommunicateNormalDelegate *communicateNormal;
    GlobalData *globalData;


    QTimer *timer;
    int timeoutCount;
    /**
     * @brief recordLoginIP     记录之前登录的IP
     */
    QString recordLoginIP;
    QString hmiIp;
    int hmiPort;

};

#endif // MOUNTDELEGATE_H
